<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>is_deallocate_trivial</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="Chapter 1. Boost.JSON">
<link rel="up" href="../ref.html" title="This Page Intentionally Left Blank 2/2">
<link rel="prev" href="boost__json__basic_parser/write_some.html" title="basic_parser::write_some">
<link rel="next" href="boost__json__is_deallocate_trivial/value.html" title="is_deallocate_trivial::value">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="boost__json__basic_parser/write_some.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost__json__is_deallocate_trivial/value.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="json.ref.boost__json__is_deallocate_trivial"></a><a class="link" href="boost__json__is_deallocate_trivial.html" title="is_deallocate_trivial">is_deallocate_trivial</a>
</h4></div></div></div>
<p>
        Return true if a memory resource's deallocate function has no effect.
      </p>
<h5>
<a name="json.ref.boost__json__is_deallocate_trivial.h0"></a>
        <span class="phrase"><a name="json.ref.boost__json__is_deallocate_trivial.synopsis"></a></span><a class="link" href="boost__json__is_deallocate_trivial.html#json.ref.boost__json__is_deallocate_trivial.synopsis">Synopsis</a>
      </h5>
<p>
        Defined in header <code class="literal">&lt;<a href="https://github.com/cppalliance/json/blob/master/include/boost/json/memory_resource.hpp" target="_top">boost/json/memory_resource.hpp</a>&gt;</code>
      </p>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span>
    <span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">is_deallocate_trivial</span>
</pre>
<h5>
<a name="json.ref.boost__json__is_deallocate_trivial.h1"></a>
        <span class="phrase"><a name="json.ref.boost__json__is_deallocate_trivial.static_members"></a></span><a class="link" href="boost__json__is_deallocate_trivial.html#json.ref.boost__json__is_deallocate_trivial.static_members">Static
        Members</a>
      </h5>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                <p>
                  Name
                </p>
              </th>
<th>
                <p>
                  Description
                </p>
              </th>
</tr></thead>
<tbody><tr>
<td>
                <p>
                  <span class="bold"><strong><a class="link" href="boost__json__is_deallocate_trivial/value.html" title="is_deallocate_trivial::value">value</a></strong></span>
                </p>
              </td>
<td>
                <p>
                  A bool equal to true if calls to <code class="computeroutput"><span class="identifier">T</span><span class="special">::</span><span class="identifier">do_deallocate</span></code>
                  have no effect.
                </p>
              </td>
</tr></tbody>
</table></div>
<h5>
<a name="json.ref.boost__json__is_deallocate_trivial.h2"></a>
        <span class="phrase"><a name="json.ref.boost__json__is_deallocate_trivial.description"></a></span><a class="link" href="boost__json__is_deallocate_trivial.html#json.ref.boost__json__is_deallocate_trivial.description">Description</a>
      </h5>
<p>
        This metafunction may be specialized to indicate to the library that calls
        to the <code class="computeroutput"><span class="identifier">deallocate</span></code> function
        of a <a class="link" href="boost__json__memory_resource.html" title="memory_resource"><code class="computeroutput"><span class="identifier">memory_resource</span></code></a> have no effect.
        The implementation will elide such calls when it is safe to do so. By default,
        the implementation assumes that all memory resources require a call to <code class="computeroutput"><span class="identifier">deallocate</span></code> for each memory region obtained
        by calling <code class="computeroutput"><span class="identifier">allocate</span></code>.
      </p>
<h5>
<a name="json.ref.boost__json__is_deallocate_trivial.h3"></a>
        <span class="phrase"><a name="json.ref.boost__json__is_deallocate_trivial.example"></a></span><a class="link" href="boost__json__is_deallocate_trivial.html#json.ref.boost__json__is_deallocate_trivial.example">Example</a>
      </h5>
<p>
        This example specializes the metafuction for <code class="computeroutput"><span class="identifier">my_resource</span></code>,
        to indicate that calls to deallocate have no effect:
      </p>
<pre class="programlisting"><span class="comment">// Forward-declaration for a user-defined memory resource</span>
<span class="keyword">struct</span> <span class="identifier">my_resource</span><span class="special">;</span>

<span class="comment">// It is necessary to specialize the template from</span>
<span class="comment">// inside the namespace in which it is declared:</span>

<span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">json</span> <span class="special">{</span>

<span class="keyword">template</span><span class="special">&lt;&gt;</span>
<span class="keyword">struct</span> <span class="identifier">is_deallocate_trivial</span><span class="special">&lt;</span> <span class="identifier">my_resource</span> <span class="special">&gt;</span>
<span class="special">{</span>
    <span class="keyword">static</span> <span class="keyword">constexpr</span> <span class="keyword">bool</span> <span class="identifier">value</span> <span class="special">=</span> <span class="keyword">true</span><span class="special">;</span>
<span class="special">};</span>

<span class="special">}</span> <span class="comment">// namespace json</span>
<span class="special">}</span> <span class="comment">// namespace boost</span>
</pre>
<p>
        It is usually not necessary for users to check this trait. Instead, they
        can call <a class="link" href="boost__json__storage_ptr/is_deallocate_trivial.html" title="storage_ptr::is_deallocate_trivial"><code class="computeroutput"><span class="identifier">storage_ptr</span><span class="special">::</span><span class="identifier">is_deallocate_trivial</span></code></a> to determine
        if the pointed-to memory resource has a trivial deallocate function.
      </p>
<h5>
<a name="json.ref.boost__json__is_deallocate_trivial.h4"></a>
        <span class="phrase"><a name="json.ref.boost__json__is_deallocate_trivial.see_also"></a></span><a class="link" href="boost__json__is_deallocate_trivial.html#json.ref.boost__json__is_deallocate_trivial.see_also">See Also</a>
      </h5>
<p>
        <a class="link" href="boost__json__memory_resource.html" title="memory_resource"><code class="computeroutput"><span class="identifier">memory_resource</span></code></a>,
        <a class="link" href="boost__json__storage_ptr.html" title="storage_ptr"><code class="computeroutput"><span class="identifier">storage_ptr</span></code></a>
      </p>
<p>
        Convenience header <code class="literal">&lt;<a href="https://github.com/cppalliance/json/blob/master/include/boost/json.hpp" target="_top">boost/json.hpp</a>&gt;</code>
      </p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2019, 2020 Vinnie Falco<br>Copyright © 2020 Krystian Stasiowski<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="boost__json__basic_parser/write_some.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost__json__is_deallocate_trivial/value.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
